/**
 * 
 */
package praktikumid.w02.p3;

/**
 * @author Aleksandr Lenin
 *
 */
public class Control {

	/**
	 * @param args string of arguments.
	 */
	public static void main(String[] args) {
		loops();
	}
	
	/**
	 * loops demo.
	 */
	public static void loops() {
		for (int i = 0; i < 10; i++) {
			System.out.print(i);
		}
		
		System.out.println();
		
		int j = 0;
		while (j < 10) {
			System.out.print(j);
			j++;
		}
		
		System.out.println();
		
		int k = 0;
		do {
			System.out.print(k);
			k++;
		} while (k < 10);
		
		System.out.println();
		
		int i = 0;
		//for ( ; ; ) { ... }
		while (true) {
			if (i > 9) {
				break;
			}
			System.out.print(i);
			i++;
		}
	}
	
	/**
	 * @param num numeric input
	 */
	public static void conditions(int num) {
		if (num == 1) {
			System.out.println("one");
		} else if (num == 10) {
			System.out.println("ten");
		} else {
			System.out.println("Unrecognized number");
		}
		
		
		switch (num) {
			case 1:
				System.out.println("one");
				break;
			case 4:
			case 5:
				System.out.println("4 or 5");
				break;
			case 10:
				System.out.println("ten");
				break;
			default:
				System.out.println("Unrecognized number");
		}
	}
	
	public static void arrays() {
		int x[] = new int[5];
		x[0] = 1;
		x[1] = 2;
		x[2] = 3;
		x[3] = 4;
		x[4] = 5;
		
		int length = x.length;
		System.out.println("Array length: " + length);
		
		String[][] str = new String[2][2];
		str[0][0] = "Some string";
		
		System.out.println("Array length: " + str.length);
		
		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.print(str[i][j] + "\t");
			}
			System.out.println();
		}
	}

}
